<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl."/css/playoffgridview.css" ?>">


<div class="tablaPartidosPlayOff">

<?php
$lastPlayoff=0;
if ($model->partidos!=null){ 
foreach ($model->partidos as $partido){
	$actualPlayoff=$partido->id_playoff;
	if ($lastPlayoff==0){
		$lastPlayoff=$partido->id_playoff;
?>
<div id="yw0" class="grid-view">
<div class="summary"><?php echo $partido->ganador?> gano la serie</div>
<table class="items">
<thead>
<tr>
<th id="yw0_c0">Fecha</th><th id="yw0_c1">Local</th><th id="yw0_c2">Resultado</th><th id="yw0_c3">Visitante</th></tr>
</thead>
<tbody>
	<?php }
	if (($lastPlayoff!=$actualPlayoff)){?>
		</tbody>
	</table>
	</div>	
		<div id="yw0" class="grid-view">
<div class="summary"><?php echo $partido->ganador?> gano la serie</div>
<table class="items">
<thead>
<tr>
<th id="yw0_c0">Fecha</th><th id="yw0_c1">Local</th><th id="yw0_c2">Resultado</th><th id="yw0_c3">Visitante</th></tr>
</thead>
<tbody>
	<?php }?>
	<tr>	
		<td style="text-align: center"><?php echo $partido->fecha?></td><td style="text-align: right"><?php echo $partido->local?><?php echo CHtml::image(Yii::app()->request->baseUrl."/images/escudos/".$partido->escudoLocal,"",array('width'=>25, 'height'=>25));?></td><td style="text-align: center" width="auto"><?php echo CHtml::ajaxLink($partido->getResultado(),Yii::app()->createUrl('historial/detailMatch'),array('success'=>'function(r){$("#juiDialog").html(r).dialog("open"); return false;}','data' => array('id' => $partido->id_partido)));?></td><td style="text-align: left"><?php echo CHtml::image(Yii::app()->request->baseUrl."/images/escudos/".$partido->escudoVisitante,"",array('width'=>25, 'height'=>25));?><?php echo $partido->visitante?></td>
	</tr>
	<?php if (($lastPlayoff!=$actualPlayoff)){?>		
	<?php }
	$lastPlayoff = $partido->id_playoff;
	?>
<?php }?>
</tbody>
	</table>
	</div>
	<?php }?>
</div>
<?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
		'id'=>'juiDialog',
		'options'=>array(
				'title'=>'Detalle del Partido',
				'autoOpen'=>false,
				'modal'=>true,
				'width'=>'500px',
				'height'=>'auto',
				'resizable'=>false,
		),
));
$this->endWidget();

?>
